package com.vrv.netmgr.assets.detail;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;

import com.vrv.common.GlobalConstants;
import com.vrv.common.util.StringUtils;
import com.vrv.netmgr.R;
import com.vrv.netmgr.vo.OsSetupLog;

/**
 * @Description 注册资产查询策略详细信息
 * @author yangzijian
 * @date
 *
 */
public class DetailOperatingSysInstallActivity extends Activity {
    private static final String TAG = DetailOperatingSysInstallActivity.class.getSimpleName();
    private static final boolean DEBUG = true && GlobalConstants.DEBUG;
    //
    private OsSetupLog info;

    public void onCreate(Bundle savedInstanceState) {
        if (DEBUG)
            Log.v(TAG, "onCreate()");

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
        setContentView(R.layout.detail_operatingsysinstall);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.common_title);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        //
        initViews();
        setTitle();
    }

    //
    public void initViews() {
        if (DEBUG)
            Log.v(TAG, "initViews()");
        //
        TextView osysi_deptName = (TextView) findViewById(R.id.osysi_deptName);
        TextView osysi_officeName = (TextView) findViewById(R.id.osysi_officeName);
        TextView osysi_userName = (TextView) findViewById(R.id.osysi_userName);
        TextView osysi_ipaddres = (TextView) findViewById(R.id.osysi_ipaddres);
        TextView osysi_uuid = (TextView) findViewById(R.id.osysi_uuid);
        TextView osysi_osname = (TextView) findViewById(R.id.osysi_osname);
        TextView osysi_setupTime = (TextView) findViewById(R.id.osysi_setupTime);
        TextView osysi_rptTime = (TextView) findViewById(R.id.osysi_rptTime);
        //
        info = (OsSetupLog) getIntent().getSerializableExtra("info");
        //
        osysi_deptName.setText(info.getOsysi_deptName());
        osysi_officeName.setText(info.getOsysi_officeName());
        osysi_userName.setText(info.getOsysi_userName());
        osysi_ipaddres.setText(info.getOsysi_ipaddres());
        osysi_uuid.setText(info.getOsysi_uuid());
        osysi_osname.setText(info.getOsysi_osname());
        osysi_setupTime.setText(info.getOsysi_setupTime());
        osysi_rptTime.setText(info.getOsysi_rptTime());
    }

    public void setTitle() {
        if (DEBUG)
            Log.v(TAG, "setTitle()");

        TextView title = (TextView) findViewById(R.id.title_text);
        if (info != null && !StringUtils.isNullOrEmpty(info.getOsysi_ipaddres())) {
            title.setText("操作系统安装查询" + "[" + info.getOsysi_ipaddres() + "]");
        } else {
            title.setText("操作系统安装查询");
        }

        /**
         * 返回按钮
         */
        ImageButton backBtn = (ImageButton) findViewById(R.id.backBtn);
        backBtn.setVisibility(View.VISIBLE);
        backBtn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
    }

    @Override
    public void onBackPressed() {
        if (DEBUG)
            Log.v(TAG, "onBackPressed()");

        finish();
        overridePendingTransition(R.anim.push_right_out, R.anim.push_right_in);
        super.onBackPressed();
    }
}
